<?php
namespace apps\fzq\controllers;

class CookiesController extends \Phalcon\Mvc\Controller
{
	public function rdAction()
	{
		
	}
	
	public function rnAction()
	{
		echo $this->session->get( 'B' ), '<br>';
		var_dump( $this->session->get( 'obj' ));
		echo $this->session->getId();
	}
	
	public function scAction()
	{
		$this->session->set( 'B', 'bbbbb' );
		
		$obj = new \stdClass();
		$obj->name = 'yes';
		$obj->age = 3;
		
		$this->session->set( 'obj', $obj );
		
		echo $this->session->getId();
	}
	
	public function ssAction()
	{
// 		var_dump( get_class( $this->session ));
// 		var_dump( get_class_methods( get_class( $this->session )) );

// 		var_dump( $this->session->getLifeTime());
		
		// var_dump( $this->session->setOptions' (length=10)
// 		var_dump( $this->session->getOptions());
// // 		var_dump( $this->session->setName( 'asdf' ));
		var_dump( $this->session->getId(), '<br>');
// 		var_dump( $this->session->getName());
// 		var_dump( $this->session->set( 'aaaa', 'AAAAAA' ) );
// 		var_dump( $this->session->get( 'aaaa' ) );
		var_dump( $this->session->destroy());
// 		var_dump( $this->session->getId());
// 		var_dump( $this->session->getName());
		
		
// 		session_regenerate_id();
		var_dump( $this->session->regenerateId(false), '<br>');
// 		var_dump( $this->session->set( 'aaaa', 'AAAAAA' ));
		var_dump( $this->session->get( 'aaaa' ));
		
// 		var_dump( $_SESSION );
// 		var_dump( $this->session->has( 'aaaa' ));
// 		var_dump( $this->session->remove( 'aaaa' ));
		
// 		var_dump( $_SESSION );
		
// 		session_regenerate_id( $this->session->getId());
		
// 		var_dump( $this->session->getId());
// 		// var_dump( $this->session->setId());
// 		var_dump( $this->session->isStarted());
// 		var_dump( $this->session->destroy());
// 		var_dump( $this->session->status());
		var_dump( $this->session->getId(), '<br>');
		
		
		
	}
	
	public function setsAction()
	{
		$this->session->set( 'A', 'AAAAAAAAAAAA' );
	}
	
	public function getsAction()
	{
		var_dump( $this->session->get( 'A' ));
	}
	
	public function getcAction()
	{
		var_dump( $_COOKIE );
		var_dump( $this->cookies->get( 'tcookie' )->getValue());
		
	}
	
	public function setcAction()
	{
		echo __METHOD__, '<br>';
		$this->cookies->set( 'tcookie', 'TCOOKIE', time() + 1500 );
		
	}
}